<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<title>ajax新闻实例和数组</title>
<script src="jquery.js"></script>
</head>
<body>
  <input type="button" value="获取新闻列表">
  <div id="info">
    <img src="ajax-loader.gif" id="loading" style="display:none;">
    <ul></ul>
  </div>
  <script type="text/javascript">
    $('input').click(function(){
    	$.ajax({
    		url:'demo23.php?'+Math.random(),
    		type:'get',
    		success:function(data){
    			//alert(data);
    			var result = eval(data);
    			for(var i=0;i<result.length;i++){
    				//alert(result[i].title);
    				$('ul').append('<li>'+result[i].title+'<em>'+result[i].publicTime+'</em></li>');
    			}
    		}
    	});
    });
    
    $(document).ajaxStart(function(){
    	$('#loading').show();
    }).ajaxStop(function(){
    	$('#loading').hide();
    });
  </script>
</body>
</html>